package models;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Id;

import com.googlecode.objectify.annotation.Cached;
import com.googlecode.objectify.annotation.Indexed;
import com.googlecode.objectify.annotation.NotSaved;
import com.googlecode.objectify.annotation.Unindexed;

@Cached
public class OrderModel implements Serializable, Comparable<OrderModel> {
	public static final long serialVersionUID = 1L;
	@Id
	private String orderId = "";

	@Indexed
	private String username = "";

	@Indexed
	private String salername = "";

	@Indexed
	private Date orderDate = new Date();

	@Indexed
	private Date newOrderDate;

	@Unindexed
	private String dealId = "";

	@Unindexed
	private List<String> listOrderProduct = new ArrayList<String>();

	@Unindexed
	private String returnCoordina = "";

	@NotSaved
	private List<OrderProductModel> listOrderProductObject = new ArrayList<OrderProductModel>();

	@NotSaved
	private int orderStep = 0;

	@NotSaved
	private DealModel deal = new DealModel();

	@Unindexed
	private String dealName = "";

	@Unindexed
	private String dealShortName = "";

	@Unindexed
	private int dealProductType = 1;
	/*
	 * 1 - Thanh toán bằng tiền mặt 2 - Thanh toán chuyển khoản.
	 */
	@Unindexed
	private int paymentType = 1;

	@Unindexed
	private String shipName = "";

	@Unindexed
	private String shipMail = "";

	@Unindexed
	private String shipCity = "";

	@Unindexed
	private String shipPhoneNumber = "";

	@Unindexed
	private String shipDistrict = "";

	@Indexed
	private String shipWard = "";

	@Unindexed
	private String shipAddress = "";

	/*
	 * 1 - Nhà riêng 2 - Công ty
	 */
	@Unindexed
	private int shipAddressType = 1;

	@Unindexed
	private String shipStreet = "";

	@Unindexed
	private String shipFloor = "";

	@Unindexed
	private String shipAddressFull = "";

	/*
	 * 1 - Giao hàng tận nơi 2 - Nhận hàng tại Group on.
	 */
	@Unindexed
	private int shipType = 1;

	@Unindexed
	private int quantity = 0;

	@Unindexed
	private int delivered = 0;

	@Unindexed
	private int unitPrice = 0;

	@Indexed
	private int totalPrice = 0;

	@Unindexed
	private String note = "";

	@Indexed
	private int fromEmail = 0;

	@Unindexed
	private boolean changeAddress = false;

	@Unindexed
	private String oldAddress = "";

	@Indexed
	private boolean checkOut = false;

	@Indexed
	private Date checkOutTime = null;

	@Unindexed
	private int oldStatus = 1;
	/*
	 * 1 - Chưa xử lý 2 - Chờ giao 3 - Đang giao 4 - Hoàn thành 5 - Huỷ 6 - Xóa
	 * 7 - Kiểm tra lại (không liên lạc được) 8 - Lock 10- Khách hẹn lại.
	 */
	@Indexed
	private int status = 1;

	public Date getCheckOutTime() {
		return checkOutTime;
	}

	public void setCheckOutTime(Date checkOutTime) {
		this.checkOutTime = checkOutTime;
	}

	public int getOldStatus() {
		return oldStatus;
	}

	public void setOldStatus(int oldStatus) {
		this.oldStatus = oldStatus;
	}

	public boolean isCheckOut() {
		return checkOut;
	}

	public void setCheckOut(boolean checkOut) {
		this.checkOut = checkOut;
	}

	public boolean isChangeAddress() {
		return changeAddress;
	}

	public void setChangeAddress(boolean changeAddress) {
		this.changeAddress = changeAddress;
	}

	public String getOldAddress() {
		return oldAddress;
	}

	public void setOldAddress(String oldAddress) {
		this.oldAddress = oldAddress;
	}

	public int getOrderStep() {
		return orderStep;
	}

	public void setOrderStep(int orderStep) {
		this.orderStep = orderStep;
	}

	public DealModel getDeal() {
		return deal;
	}

	public void setDeal(DealModel deal) {
		this.deal = deal;
	}

	public int getShipAddressType() {
		return shipAddressType;
	}

	public void setShipAddressType(int shipAddressType) {
		this.shipAddressType = shipAddressType;
	}

	public String getShipMail() {
		return shipMail;
	}

	public void setShipMail(String shipMail) {
		this.shipMail = shipMail;
	}

	public int getShipType() {
		return shipType;
	}

	public void setShipType(int shipType) {
		this.shipType = shipType;
	}

	public List<String> getListOrderProduct() {
		return listOrderProduct;
	}

	public void setListOrderProduct(List<String> listOrderProduct) {
		this.listOrderProduct = listOrderProduct;
	}

	public List<OrderProductModel> getListOrderProductObject() {
		return listOrderProductObject;
	}

	public void setListOrderProductObject(
			List<OrderProductModel> listOrderProductObject) {
		this.listOrderProductObject = listOrderProductObject;
	}

	public int getFromEmail() {
		return fromEmail;
	}

	public void setFromEmail(int fromEmail) {
		this.fromEmail = fromEmail;
	}

	public String getSalername() {
		return salername;
	}

	public void setSalername(String salername) {
		this.salername = salername;
	}

	public String getShipAddressFull() {
		return shipAddressFull;
	}

	public void setShipAddressFull(String shipAddressFull) {
		this.shipAddressFull = shipAddressFull;
	}

	public int getDealProductType() {
		return dealProductType;
	}

	public void setDealProductType(int dealProductType) {
		this.dealProductType = dealProductType;
	}

	public String getDealShortName() {
		return dealShortName;
	}

	public void setDealShortName(String dealShortName) {
		this.dealShortName = dealShortName;
	}

	public String getDealName() {
		return dealName;
	}

	public void setDealName(String dealName) {
		this.dealName = dealName;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public Date getOrderDate() {
		return orderDate;
	}

	public void setOrderDate(Date orderDate) {
		this.orderDate = orderDate;
	}

	public Date getNewOrderDate() {
		return newOrderDate;
	}

	public void setNewOrderDate(Date newOrderDate) {
		this.newOrderDate = newOrderDate;
	}

	public int getPaymentType() {
		return paymentType;
	}

	public void setPaymentType(int paymentType) {
		this.paymentType = paymentType;
	}

	public String getShipName() {
		return shipName;
	}

	public void setShipName(String shipName) {
		this.shipName = shipName;
	}

	public String getShipCity() {
		return shipCity;
	}

	public void setShipCity(String shipCity) {
		this.shipCity = shipCity;
	}

	public String getShipPhoneNumber() {
		return shipPhoneNumber;
	}

	public void setShipPhoneNumber(String shipPhoneNumber) {
		this.shipPhoneNumber = shipPhoneNumber;
	}

	public String getShipDistrict() {
		return shipDistrict;
	}

	public void setShipDistrict(String shipDistrict) {
		this.shipDistrict = shipDistrict;
	}

	public String getShipWard() {
		return shipWard;
	}

	public void setShipWard(String shipWard) {
		this.shipWard = shipWard;
	}

	public String getShipAddress() {
		return shipAddress;
	}

	public void setShipAddress(String shipAddress) {
		this.shipAddress = shipAddress;
	}

	public String getShipStreet() {
		return shipStreet;
	}

	public void setShipStreet(String shipStreet) {
		this.shipStreet = shipStreet;
	}

	public String getShipFloor() {
		return shipFloor;
	}

	public void setShipFloor(String shipFloor) {
		this.shipFloor = shipFloor;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	public int getDelivered() {
		return delivered;
	}

	public void setDelivered(int delivered) {
		this.delivered = delivered;
	}

	public int getUnitPrice() {
		return unitPrice;
	}

	public void setUnitPrice(int unitPrice) {
		this.unitPrice = unitPrice;
	}

	public int getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(int totalPrice) {
		this.totalPrice = totalPrice;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getOrderId() {
		return orderId;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}

	public String getDealId() {
		return dealId;
	}

	public void setDealId(String dealId) {
		this.dealId = dealId;
	}

	public String getReturnCoordina() {
		return returnCoordina;
	}

	public void setReturnCoordina(String returnCoordina) {
		this.returnCoordina = returnCoordina;
	}

	@Override
	public int compareTo(OrderModel o) {
		// TODO Auto-generated method stub
		return Long.valueOf(this.orderDate.getTime()).compareTo(
				o.orderDate.getTime());
	}

}
